/*
 *@description:顾客相关的接口
 *@Author:@rennan
 *@Date:2024-06-29 14:52:24
 *@version: V1.0.0
*/

const express = require('express');
const router = express.Router();

const sql = require('../db/index');

// 分页获取所有顾客信息
router.get('/customer', async (req, res) => {
  let { page, pageSize } = req.query;
  console.log("传递的参数:",req.query);
  
  // 计算偏移量
 let start = (page - 1) * pageSize;
  
  // 查询顾客信息
   let [customers] = await sql.query(`SELECT * FROM jz_account_customer LIMIT ${start},${pageSize}`);


  res.send({
    code: 200,
    message: '获取顾客信息成功',
    data: customers,
    total: 10
  })

})

module.exports = router